#include <lib.h>
#define dfs_get_cache_path _dfs_get_cache_path
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <dfs.h>
/*
 * Implementation of the library function for
 * the _dfs_get_cache_path system call
 */

#if _ANSI
PUBLIC int dfs_get_cache_path(const char *key,char *value)
#else
PUBLIC int dfs_get_cache_path(key,value)
const char key
char value
#endif
{
	int r;
    char filepath[PATH_MAX];
    message m;
	
	memset(filepath,0,PATH_MAX);
	/* Set message to be sent */
	
	m.FILEALIAS = (char *)key;
    m.FILEALIASLEN = strlen(key);
    m.FILEPATH = filepath;
	memset(m.FILEPATH,0,sizeof(m.FILEPATH));
	printf("Making Call %s\n",m.FILEALIAS);
	/* Making the call */
	r = _syscall(DFS,DFS_GET_CACHE_PATH,&m);
	if (r != OK) return (ERROR);
	
    /* Return results */
	memcpy(value,m.FILEPATH,strlen(m.FILEPATH));
	printf("lib:%s\n",value);
	return OK;
}